﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPF.BytesIO.Serial.Models
{
    public class Status : NotifyObject
    {
        #region Name
        private string _Name;
        /// <summary>
        /// Name
        /// </summary>
        public string Name
        {
            get { return _Name; }
            set
            {
                _Name = value;
                OnPropertyChanged("Name");
            }
        }
        #endregion

        #region Text
        private string _Text;
        /// <summary>
        /// Text
        /// </summary>
        public string Text
        {
            get { return _Text; }
            set
            {
                _Text = value;
                OnPropertyChanged("Text");
            }
        }
        #endregion

        #region Color
        private string _Color;
        /// <summary>
        /// Color
        /// </summary>
        public string Color
        {
            get { return _Color; }
            set
            {
                _Color = value;
                OnPropertyChanged("Color");
            }
        }
        #endregion

        public Status(string text, MyBrushes statusBrush = MyBrushes.Red)
        {
            this._Text = text;
            this.Color = statusBrush.ToBrushString();
        }

        #region 更新状态
        /// <summary>
        /// 更新状态
        /// </summary>
        /// <param name="text"></param>
        /// <param name="statusBrush"></param>
        public void Update(string text, MyBrushes statusBrush)
        {
            this.Text = text;
            this.Color = statusBrush.ToBrushString();
        }
        #endregion

        public override string ToString()
        {
            return this.Text;
        }
    }
}
